var nameSpace="menuItem";

function setObjAttr(e, that, attr, value) {
  var name = e.currentTarget.dataset.event;
  var attrname = nameSpace+ "." + name + "." + attr;
  var obj = {};
  obj[attrname] = value;
  that.setData(obj);
}


var menuEvent = {

  "menu1": function (e,that) {

    if (that.data.menuitem.showmenu1) {
     
      that.setData({
        menuitem: {
          showmenu1: false,
          showmenu2: true,
          showmenu3: true,
          showmenu4: true,
          showmenu5: true
        }

      })
    }
    else {
    
      that.setData({
        menuitem: {
          showmenu1: true,
          showmenu2: true,
          showmenu3: true,
          showmenu4: true,
          showmenu5: true
        }
      })
    }
},

  "menu2": function (e,that) {
    if (that.data.menuitem.showmenu2) {
      that.setData({
        menuitem: {
          showmenu1: true,
          showmenu2: false,
          showmenu3: true,
          showmenu4: true,
          showmenu5: true
        }

      });
    }
    else {
      that.setData({
        menuitem: {
          showmenu1: true,
          showmenu2: true,
          showmenu3: true,
          showmenu4: true,
          showmenu5: true
        }

      })
    }
  },
  "menu3": function (e) {
    console.log("menu3 Event");
    console.log(e);
  },
  "menu4": function (e) {
    console.log("menu4 Event");
    console.log(e);
  },
  "menu5": function (e,that) {
   
    if(that.data.menuitem.showmenu5)
    {
      that.setData({
        menuitem: {
          showmenu1: true,
          showmenu2: true,
          showmenu3: true,
          showmenu4: true,        
          showmenu5: false
        }

      })
    }
    else{
      that.setData({
        menuitem: {
          showmenu1: true,
          showmenu2: true,
          showmenu3: true,
          showmenu4: true,
          showmenu5: true
        }

      })
    }
  } 
}
 

module.exports.menuEvent = menuEvent;
 